<?php
namespace app\admin\controller;

use think\Controller;
use app\common\model\Admin;
use houdunwang\crypt\Crypt;

class Login extends Controller
{
	public function index ()
	{

	}

	public function login()
	{
		//echo Crypt::encrypt('admin888'); //加密：h3vPU8JGuF3VS/uxIpjRSw== 
		//echo Crypt::decrypt('h3vPU8JGuF3VS/uxIpjRSw==');//测试解密 admin888
		if(request()->isPost()){
			$res=(new Admin())->login(input('post.'));
			if($res['valid'])
			{
				//说明登录成功
				$this->success($res['msg'],'entry/index');
			}else{
				//说明登录失败
				$this->error($res['msg']);exit;
			}
		}
		return $this->fetch();
	}
}